#include "Texture.h"

Texture::Texture(TiXmlElement *element) {

	length_s = 0; length_t = 0;
	handleTexture(element);
}

bool Texture::handleTexture(TiXmlElement *element) {
	if( element == NULL )
		return ERROR;

	const string id_temp(element->Attribute("id"));
	id = id_temp;
	const string filep(element->Attribute("file"));
	filePath = filep;
	
	if (element->QueryDoubleAttribute("length_s", &length_s) == TIXML_SUCCESS &&
		element->QueryDoubleAttribute("length_t", &length_t) == TIXML_SUCCESS) {
			return NO_ERROR;
	}

	return NO_ERROR;
}

void Texture::printTexture()  {
	cout << "ID: " << id << endl;
	cout << "File Path: " << filePath << endl;
	cout << "length_s: " << length_s << endl;
	cout << "length_t: " << length_t << endl;
}